"""
公共方法
"""
import logging
import string
import random
import time
import traceback

from flask import Blueprint, make_response, current_app
from ronglian_sms_sdk import SmsSDK

from common.utils.captcha import Captcha
from common.models import cache
from celery_task.main import celery_app


accId = '8aaf07087f77bf96017fd54021082f71'
accToken = 'fcc9d94e2c324d32a93081fe8323c959'
appId = '8aaf07087f77bf96017fd54021ff2f78'


def generate_code():
    return Captcha.gene_graph_captcha()


@celery_app.task(name='common.utils.utils.phone_code')
def phone_code(mobile, code):
    """
    短信验证码功能
    :return:
    """
    # sdk = SmsSDK(accId, accToken, appId)
    # datas = (code, '5')
    resp = 1
    time.sleep(10)
    # resp = sdk.sendMessage('1', mobile, datas)
    return resp




